<?php

/**
 * principal actions.
 *
 * @package    BecArTe
 * @subpackage principal
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class principalActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
  }

  public function executeContacto(sfWebRequest $request)
  {
  }

  public function executeRequisitos(sfWebRequest $request)
  {
    $this->categoria = CategoriaTable::getInstance()->findOneById($request->getParameter('id'));
  }

  public function executeRequisitosComunes(sfWebRequest $request)
  {
  }

  public function executeSedes(sfWebRequest $request)
  {
    $this->sedes = SedeTable::getInstance()->findAll();
  }


  public function executeConsultaTramite(sfWebRequest $request)
  {
    //ofrece formulario de consulta
    $this->form = new ConsultaTramitesForm();
    //si recibe parametros busca usando el webservice propio
    if($request->hasParameter( $this->form->getName() )) {
      $values = $request->getParameter( $this->form->getName() );
      $this->form->bind($values);
      if($this->form->isValid()) {
        $wsdl_url = sfConfig::get('app_url_ws_interno');
        $client = new SOAPClient($wsdl_url);
        //die( var_dump($client->__getFunctions()) );
        $result = $client->ObtenerEstadoDeTramites(
                      $values['tipo_doc'],
                      $values['numero']
                  );
        $this->tramites = $result->item;
      }
    }

  }

}
